package com.itheima.controller;

import com.fasterxml.jackson.databind.JsonNode;
import com.itheima.entity.Audits;
import com.itheima.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户概况(Userprofile)表控制层
 *
 * @author guanhuaer
 * @since 2024-09-04 21:14:09
 */
@RestController
@RequestMapping("/audits")
public class AuditsController {

    @PostMapping("/opinionList")
    @ApiOperation("项目审核")
    public Result opinionList(@RequestBody JsonNode opinionList){
        JsonNode opin = opinionList.get("opinionList");
        Audits audits = new Audits();
        for (JsonNode op : opin){
            audits.setId(String.valueOf(op.get(0).get("id")));
            audits.setTitle(String.valueOf(op.get(0).get("title")));
            audits.setContent(String.valueOf(op.get(0).get("content")));
            audits.setAppraise(String.valueOf(op.get(0).get("appraise")));
            audits.setProsCons(String.valueOf(op.get(0).get(" prosCons")));
            audits.setDirection(String.valueOf(op.get(0).get("directio")));
            audits.setProtype(String.valueOf(op.get(0).get("protype")));
        }
        return Result.success();
    }


}
